package com.cennavi.function;

import com.googlecode.aviator.runtime.function.AbstractFunction;
import com.googlecode.aviator.runtime.function.FunctionUtils;
import com.googlecode.aviator.runtime.type.AviatorDouble;
import com.googlecode.aviator.runtime.type.AviatorLong;
import com.googlecode.aviator.runtime.type.AviatorObject;

import java.util.*;

/**
 * @author GongXings
 * @createTime 16 11:17
 * @description
 */
public class QualityFunction extends AbstractFunction {

    @Override
    /**
     * @param
     * arg1 cost 真实值 (s-mile)*change+pirce
     * arg2 cost 集合中的最小值 min(list)
     */
    public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {
        String fm="";
        for (String key : env.keySet()) {
            if(fm.length()==0){
                fm=key+"*"+key+"kpi";
            }else {
                fm=fm+"+"+key+"*"+key+"kpi";
            }
        }
//        Number min  = FunctionUtils.getNumberValue(arg1, env);
//        double result = (2-(real.doubleValue()/min.doubleValue()))*100;

        return null;
    }

    @Override
    public String getName() {
        return "quality";
    }
}